import { PrismaClient } from "@prisma/client";

const data = [
    {
        name: "推荐",
        code: "recommend"
    },
    {
        name: "热点",
        code: "hot"
    },
    {
        name: "财经",
        code: "finance"
    },
    {
        name: "科技",
        code: "tech"
    },
    {
        name: "时政",
        code: "politics"
    },
    {
        name: "民生",
        code: "social"
    },
    {
        name: "军事",
        code: "military"
    },
    {
        name: "体育",
        code: "sports"
    },
    {
        name: "娱乐",
        code: "entertainment"
    },
    {
        name: "时尚",
        code: "fashion"
    },
    {
        name: "汽车",
        code: "car"
    },
    {
        name: "游戏",
        code: "game"
    },
    {
        name: "旅游",
        code: "travel"
    },
    {
        name: "美食",
        code: "food"
    },
    {
        name: "育儿",
        code: "baby"
    },
    {
        name: "健康",
        code: "health"
    },
    {
        name: "房产",
        code: "house"
    },
    {
        name: "教育",
        code: "education"
    },
    {
        name: "文化",
        code: "culture"
    }
];

export const seedCategories = async (prisma: PrismaClient) => {
    await prisma.category.deleteMany();
    await prisma.category.createMany({
        data: data.map((item, index) => {
            return {
                name: item.name,
                code: item.code,
                sort: index + 10,
                description: ""
            };
        })
    });
};
